package com.hcb.tonguetiphealth.adapter;

import java.util.List;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

public class GeneralPageAdapter extends PagerAdapter {
	private List<View> pageViews;
	private int mCount;
	public GeneralPageAdapter(List<View> pageViews) {
		this.pageViews = pageViews;
		mCount = pageViews.size();
	}
	
	public int getCount() {
		return mCount;
	}

	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1 ;
	}
	
	 
	public int getItemPosition(Object object) {
		return super.getItemPosition(object);
	}
	 
	public void destroyItem(View arg0, int arg1, Object arg2) {
		 
 	}

	 
	public Object instantiateItem(View arg0, int arg1) {
	try{
		((ViewPager) arg0).addView(pageViews.get(arg1%pageViews.size()),0);
	}catch(Exception e){
	}
		return 	pageViews.get(arg1%pageViews.size()); 
	}

	 
	public void restoreState(Parcelable arg0, ClassLoader arg1) {
	}
	 
	public Parcelable saveState() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void startUpdate(View arg0) {
		// TODO Auto-generated method stub
	}

	@Override
	public void finishUpdate(View arg0) {
		// TODO Auto-generated method stub
	}

}
